/*
 * @Author: xiaosihan
 * @Date: 2024-10-30 05:48:42
 * @Last Modified by: xiaosihan
 * @Last Modified time: 2024-10-30 18:20:35
 */

import { observable, configure } from 'mobx';
configure({ enforceActions: 'never' });

const modelIntroductionStore = observable(
  {
    //选中的模型
    modelTypeActive: 0,
    setModelTypeActive(modelTypeActive: number) {
      this.modelTypeActive = modelTypeActive;
    },

    page: 1, //当前页面
    pageSize: 10, //分页数
    total: 0, //总数
    list: [] as Array<any>, //数据列表
    //请求数据
    async getList(page: number = 1, pageSize: number = 10) {
      this.page = page;
      this.pageSize = pageSize;
      this.list = []; // 请求数据
    },
    //新增数据
    add(data: any) {
      // 新增完后请求数据
      this.getList();
    },
    //删除数据
    delete(id: string) {
      // 删除完后请求数据
      this.getList();
    },
    //更新数据
    updata(data: any) {
      // 更新完后请求数据
      this.getList();
    },
  },
  {},
  { deep: false }
);
export default modelIntroductionStore;
